// grid布局
import './index.less'

function setColor(item){
    let r = parseInt(Math.random() * 255)
    let g = parseInt(Math.random() * 255)
    let b = parseInt(Math.random() * 255)
    item.style.backgroundColor = `rgb(${r}, ${g}, ${b})`
}

document.getElementById('root').innerHTML = `
    <span>span1</span>
    <div class='gridWrap'>
        <div>Hello, my name is Sam!</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
        <div>7</div>
        <div>8</div>
        <div>9</div>
    </div>
    <span>span2</span>
`

document.querySelectorAll('.gridWrap > div').forEach(setColor)
